home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: newsfeed.internetmci.com!miwok!linex1!news
- From: mfried@linex.com (Marty Fried)
- Subject: Re: word vs. byte alignment option
- X-Nntp-Posting-Host: sp91.linex.com
- Message-ID: <316dcf45.6005800@news.linex.com>
- Sender: news@linex1.linex.com
- Organization: Cirrius Cybernetics Corp
- X-Newsreader: Forte Agent .99e/32.201
- References: <4kdq3b$lhn@sloth.swcp.com>
- Date: Fri, 12 Apr 1996 03:40:03 GMT
-
- Once upon a time (OK, it was 9 Apr 1996 13:52:43 GMT),
- dvines@sparton.com (Dudley Vines) wrote:
-
- >Anybody ever have trouble with Borland C++ compiler word vs. byte
- >alignment option? When I attempt to load a word aligned array into a byte
- >aligned array, the data in the byte aligned array is off by one byte.
- >
- >The arrays come from separate modules with different alignement options
- >set.
- >
- >I thought the alignment option only affected speed or memory usage...why
- >doesn't the compiler figure out how to handle the data right?
- >
- >e-mail help, please...
-
- The compiler can only align the data in the way it was told; there's
- no way for the compiler to know what another program has used once
- it's been compiled.
-
- The way this potential problem seems to be more or less handled is by
- using pragmas in the include file for alignment of structures declared
- in that file, if it doesn't use the default alignment, or even if it
- does, just to be safe. But you have to get fancy, so that you restore
- the original alignment. There's some sort of push/pop mechanism.
-
- cc: dvines@sparton.com (Dudley Vines)
-
- _______________________________________________________
- Marty Fried - mfried@linex.com Press Enter to Exit
- San Anselmo, CA -NT message
- (MSVC4 + MFC) && (Win95 || NT);
-